package com.lam.schedule.entity;

import java.util.Date;

import com.lam.common.base.domain.BaseEntity;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.utils.DateUtil;
import com.lam.common.utils.StringUtils;

/**
 * 执行器状态对象 qrtz_scheduler_state
 * 
 * @author admin
 * @date 2022-10-29
 */
public class QrtzJobSchedilerState implements BaseEntity{

	/** 执行器 */
    private String schedName;
    /** 实例名 */
    private String instanceName;
    private String instanceIp;
    private String instanceId;
    /** 触发器 */
    private String triggerName;
    /** 触发器组 */
    private String triggerGroup;
    /** cron表达式 */
    private String cronExpression;
    /** 时区标识 */
    private String timeZoneId;
    /** 触发时间 */
    private Long firedTime;
    /** 调度时间 */
    private Long schedTime;
    /** 是否非并发，0串行执行，1并发执行 */
    @Dict(dictCode = "concurrent_type")
    private String nonconcurrent;
    
    /** 下一次触发时间 */
    private Long nextFireTime;

    /** 上一次触发时间 */
    private Long prevFireTime;

    /** 优先级 */
    private Long priority;

    /** 触发器状态 */
    @Dict(dictCode = "schedule_status")
    private String triggerState;

    /** 触发器类型 */
    private String triggerType;

    /** 开始时间 */
    private Long startTime;

    /** 结束时间 */
    private Long endTime;

    /**  */
    private Integer misfireInstr;

    /** 任务数据 */
    private String jobData;

	public String getSchedName() {
		return schedName;
	}

	public void setSchedName(String schedName) {
		this.schedName = schedName;
	}

	public String getInstanceName() {
		return instanceName;
	}

	public void setInstanceName(String instanceName) {
		this.instanceName = instanceName;
		String[] ss = StringUtils.split(instanceName, "-");
		this.instanceIp = ss[0];
		if(ss.length>1) {
			this.instanceId = ss[1];
		}
	}

	public String getTriggerName() {
		return triggerName;
	}

	public void setTriggerName(String triggerName) {
		this.triggerName = triggerName;
	}

	public String getTriggerGroup() {
		return triggerGroup;
	}

	public void setTriggerGroup(String triggerGroup) {
		this.triggerGroup = triggerGroup;
	}

	public String getNextFireTime() {
		return nextFireTime!=null&&nextFireTime>0?DateUtil.formatDateTime(new Date(nextFireTime)):"";
	}

	public void setNextFireTime(Long nextFireTime) {
		this.nextFireTime = nextFireTime;
	}
	
	public void nextFireTime(Date nextFireTime) {
		if(nextFireTime != null) {
			this.nextFireTime = nextFireTime.getTime();
		}
	}

	public String getPrevFireTime() {
		return prevFireTime!=null&&prevFireTime>0?DateUtil.formatDateTime(new Date(prevFireTime)):"";
	}

	public void setPrevFireTime(Long prevFireTime) {
		this.prevFireTime = prevFireTime;
	}
	
	public void prevFireTime(Date prevFireTime) {
		if(prevFireTime != null) {
			this.prevFireTime = prevFireTime.getTime();
		}
	}

	public Long getPriority() {
		return priority;
	}

	public void setPriority(Long priority) {
		this.priority = priority;
	}

	public String getTriggerState() {
		return triggerState;
	}

	public void setTriggerState(String triggerState) {
		this.triggerState = triggerState;
	}

	public String getTriggerType() {
		return triggerType;
	}

	public void setTriggerType(String triggerType) {
		this.triggerType = triggerType;
	}

	public String getStartTime() {
		return startTime!=null&&startTime>0?DateUtil.formatDateTime(new Date(startTime)):"";
	}

	public void setStartTime(Long startTime) {
		this.startTime = startTime;
	}
	public void startTime(Date startTime) {
		if(startTime != null) {
			this.startTime = startTime.getTime();
		}
	}

	public String getEndTime() {
		return endTime!=null&&endTime>0?DateUtil.formatDateTime(new Date(endTime)):"";
	}

	public void setEndTime(Long endTime) {
		this.endTime = endTime;
	}
	public void endTime(Date endTime) {
		if(endTime != null) {
			this.endTime = endTime.getTime();
		}
	}

	public Integer getMisfireInstr() {
		return misfireInstr;
	}

	public void setMisfireInstr(Integer misfireInstr) {
		this.misfireInstr = misfireInstr;
	}

	public String getJobData() {
		return jobData;
	}

	public void setJobData(String jobData) {
		this.jobData = jobData;
	}

	public void setInstanceIp(String instanceIp) {
		this.instanceIp = instanceIp;
	}

	public String getInstanceIp() {
		return instanceIp;
	}
	
	public String getInstanceId() {
		return instanceId;
	}

	public void setInstanceId(String instanceId) {
		this.instanceId = instanceId;
	}

	public String getCronExpression() {
		return cronExpression;
	}

	public void setCronExpression(String cronExpression) {
		this.cronExpression = cronExpression;
	}

	public String getTimeZoneId() {
		return timeZoneId;
	}

	public void setTimeZoneId(String timeZoneId) {
		this.timeZoneId = timeZoneId;
	}

	public String getFiredTime() {
		return firedTime!=null&&firedTime>0?DateUtil.formatDateTime(new Date(firedTime)):"";
	}

	public void setFiredTime(Long firedTime) {
		this.firedTime = firedTime;
	}
	public void firedTime(Date firedTime) {
		if(firedTime != null) {
			this.firedTime = firedTime.getTime();
		}
	}

	public String getSchedTime() {
		return schedTime!=null&&schedTime>0?DateUtil.formatDateTime(new Date(schedTime)):"";
	}

	public void setSchedTime(Long schedTime) {
		this.schedTime = schedTime;
	}
	public void schedTime(Date schedTime) {
		if(schedTime != null) {
			this.schedTime = schedTime.getTime();
		}
	}

	public String getNonconcurrent() {
		return nonconcurrent;
	}

	public void setNonconcurrent(String nonconcurrent) {
		this.nonconcurrent = nonconcurrent;
	}

}
